home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Views
/
Canvas
/
CanvasMaintainer.cp
< prev
next >
Wrap
Text File
|
2000-06-23
|
850b
|
54 lines
// CanvasMaintainer.cp
#ifndef CanvasMaintainer_h
#include "CanvasMaintainer.h"
#endif
#ifndef Canvas_h
#include "Canvas.h"
#endif
#ifndef GrafPortObject_h
#include "GrafPortObject.h"
#endif
#ifndef QuickDrawUser_h
#include "QuickDrawUser.h"
#endif
const Canvas *CanvasMaintainer::current = 0;
CanvasMaintainer::~CanvasMaintainer()
{
if ( current == old )
return;
if ( old == 0 )
QuickDrawUser().NoPort().BeCurrent();
else
{
old->Port().BeCurrent();
SetClip( old->Clip() );
}
current = old;
}
void CanvasMaintainer::Use( const Canvas& toUse )
{
Assert( toUse.HasPort() );
if ( &toUse == current )
return;
toUse.Port().BeCurrent();
SetClip( toUse.Clip() );
current = &toUse;
}
void CanvasMaintainer::UseNone()
{
if ( current == 0 )
return;
QuickDrawUser().NoPort().BeCurrent();
current = 0;
}